<template>
    <div id="favorite">
        <!--<haders title="我的收藏"></haders>-->
		<scroller ref="scroller" :on-infinite="infinite">
			<div class="mian"> 
				<ul class="favor">
					<li v-for="item in items" @click="skip(item)">
						<i><img :src="item.GoodsImg" alt="加载失败" :onerror="imgError"/></i>
						<p class="aline2  p_text">{{item.GoodsName}}</p>
						<p class="p_pic"><font class="c-red">￥{{item.CloudPrice}}</font>  <span>已拼:<font class="c-red">{{item.ActorCount}}</font>件</span>       <a class="box-show">一键拼单</a></p>
					</li> 
				</ul>
				
				
				<!--没有数据时-->
				<!--<no-data v-if="items==0" title="您还没有收藏任何东西~~~"></no-data>-->

			</div>
		</scroller>
    </div>    
</template>
<script> 
	import { Indicator } from 'mint-ui';
export default { 
  name: 'favorite',
  components:{
  },
  data () {
    return {
       indexPage:1,//请求页面索引
      items:[],
      done:''
    }
  },
    created() {
			this.imgError = this.$store.state.imgError; 
		},
  mounted(){

  },
  methods:{
	 infinite(done) {
	 			Indicator.open({text: '加载中...'});
				let _this = this;
				_this.done=done; 
				_this.$http.get("/GroupBuy/GetMyCollection", {
					params: {
						"page": this.indexPage,
						"type":2
					}
				}).then((res) => {
					console.log(res);
					if(res.data.data.List == "") {
						done(true);
					} else {
						if(_this.indexPage <= res.data.data.TotalPage) {
							_this.indexPage++;
							_this.items = _this.items.concat(res.data.data.List);
							 
							setTimeout(function() {
								done()
							}, 3000)
						} else {
							done(true)
						}
					}
					Indicator.close();
				}).catch((err) => {
					console.log(err)
				});
			},
			skip(item){
				this.$router.push({
					path: '/clientele/goodsDetails/' + item.GoodsId
				});
			}
  }
}
</script>
<style scoped>
	.mian{
		
	}
	.favor{
		width: 100%;
		overflow: hidden;
		background-color: #F2F2F2;
	}
	.favor li{
		width: 100%;
		background-color: #fff;
		padding-top:0.2rem;
		margin-bottom: 0.1rem;
		
	}
	.favor li i{
		display: inline-block;
		width: 100%;
		height: 4rem;
		background-color: #fff;
		text-align: center;
	}
	.favor li i img{
		/*width: 100%; */
		height: 100%;
	}
	.favor li p{
		padding: 0.1rem 0.3rem;
		color: #333;
		font-size:0.346666rem;
		overflow: hidden;
	}
	.p_pic{
		line-height:0.7555rem;
	}
	.p_pic span{
		margin-left: 1rem; 
	}
	.p_pic a{
		display: inline-block;
		float: right;
		padding: 0.1rem 0.4rem;
		color: #FFFFFF; 
		line-height:initial;
	}
	
</style>
